<?php

namespace app\api\controller\cps;

use app\common\controller\Api;



/**
 * 抖音联盟接口
 */
class Dy extends Api
{

    protected $noNeedRight = ['*'];

    //团购商品
    public function goods()
    {
        try {
            $category_id = input('category_id',0);
            $sort_by = input('sort_by',0);
            $order_by = input('order_by',0);
            $cursor = input('cursor','');
            $longitude = input('longitude','');
            $latitude = input('latitude','');
            $keyword = input('keyword','');
            $jd_model = new \app\api\model\cps\Dy();

            $res = $jd_model->goods($category_id,$sort_by,$order_by,$cursor,$longitude,$latitude,$keyword);
        }  catch (\Exception $e) {
            $this->error($e->getMessage());
        }
        $this->success('请求成功',$res);
    }

    //商品转链
    public function link()
    {
        try {
            $command = input('command','');

            $jd_model = new \app\api\model\cps\Dy();

            $res = $jd_model->link($command,$this->auth->id,$this->auth->mobile);
        }  catch (\Exception $e) {
            $this->error($e->getMessage());
        }
        $this->success('请求成功',$res);
    }

    //订单
    public function order()
    {
        try {
            $jd_model = new \app\api\model\cps\Dy();

            $res = $jd_model->order();
        }  catch (\Exception $e) {
            $this->error($e->getMessage());
        }
        $this->success('请求成功',$res);
    }
}